/*
 * @Description:
 * @Author: wsm
 * @Date: 2021-06-23 17:02:20
 * @LastEditTime: 2021-06-23 17:04:57
 * @LastEditors: wsm
 * @Reference:
 */
import { Pipe, PipeTransform } from '@angular/core';
import { DomSanitizer } from '@angular/platform-browser';

@Pipe({
  name: 'safehtml',
})
export class TrushtmlPipe implements PipeTransform {
  constructor(private sanitizer: DomSanitizer) {}

  transform(value: any, args?: any): any {
    try {
      if (!value || value === '') {
        return '';
      }
      return this.sanitizer.bypassSecurityTrustHtml(value);
    } catch (e) {
      return '';
    }
  }
}
